<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Backup extends CI_Controller {
	
	private $tab ='system';
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	function backup_show_db(){
		$this->load->model('systemset_model');
		$vdata = $this->systemset_model->show_tables();
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'backup';
		$this->load->view("/sys_admin/system/backup_table",$vdata);
	}
	
	function backup_desc_db($table){
		$this->load->model('systemset_model');
		if($table){
			$vdata = $this->systemset_model->desc_tables($table);
			$vdata['table'] = $table;
			$vdata['tab'] = $this->tab;
			$vdata['sub'] = 'backup';
			$this->load->view("/sys_admin/system/backup_desc_table",$vdata);
		}else{
			header("location:/sys_admin/backup/backup_show_db/");
		}
		
	}
	
	function backup_db(){
		$filename = date('YmdHis')."_mybackup.sql";
		$tmpFile = (dirname(dirname(dirname(dirname(__FILE__)))))."\/backup\/".$filename; 
		exec("mysqldump -uroot -pGsDal.Mygs1 --default-character-set=utf8 zhsjr > ".$tmpFile);
		echo "数据已备份至：".(dirname(dirname(dirname(dirname(__FILE__)))))."/backup/".$filename;
	}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Backup extends CI_Controller {
    
	private $tab ='system';
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	function backup_show_db(){
		$this->load->model('systemset_model');
		$vdata = $this->systemset_model->show_tables();
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'backup';
		$this->load->view("/sys_admin/system/backup_table",$vdata);
	}
	
	function backup_desc_db($table){
		$this->load->model('systemset_model');
		if($table){
			$vdata = $this->systemset_model->desc_tables($table);
			$vdata['table'] = $table;
			$vdata['tab'] = $this->tab;
			$vdata['sub'] = 'backup';
			$this->load->view("/sys_admin/system/backup_desc_table",$vdata);
		}else{
			header("location:/sys_admin/backup/backup_show_db/");
		}
		
	}
	
	function backup_db(){
		$filename = date('YmdHis')."_mybackup.sql";
		$tmpFile = (dirname(dirname(dirname(dirname(__FILE__)))))."\/backup\/".$filename; 
		exec("mysqldump -uroot -pGsDal.Mygs1 --default-character-set=utf8 zhsjr > ".$tmpFile);
		echo "数据已备份至：".(dirname(dirname(dirname(dirname(__FILE__)))))."/backup/".$filename;
	}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}